'''
此代理在幕后调用Pandas DataFrame代理，
后者调用Python代理，执行LLM生成的Python代码
- 如果LLM生成的Python代码有害，则可能会存在风险，请谨慎使用
'''

# from langchain.agents import create_csv_agent
from langchain_experimental.agents import create_csv_agent
from langchain.agents.agent_types import AgentType
# from langchain.llms import OpenAI
# 替换为千问大模型
from ChatQwen import ChatQwen
path = ['E:/pythonworkspace/Study/LangChainDemo/Tools/titanic.csv']
# 只能通过path进行csv文档引入
agent = create_csv_agent(
    llm=ChatQwen(),
    path=path,
    agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION
)

resp = agent.run("how many rows are there?")
print(resp)


